//
//  FLMBuyDeailsView.m
//  FLMSuperS
//
//  Created by xiaoyang on 16/10/9.
//  Copyright © 2016年 FaLaoMiaoNetworkTechnologyCo. All rights reserved.
//

#import "FLMBuyDeailsView.h"
#import "FLMDeatilListModel.h"
@implementation FLMBuyDeailsView

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame: frame];
    if (self) {
        
        self.backgroundColor = white;
        
        [self addSubview:self.priceL];
        [self addSubview:self.zheKouL];
        [self addSubview:self.quanBtn];
        [self addSubview:self.buyBtn];
        
    }
    return self;
    
}



#pragma mark-价格
-(SLable *)priceL{
    
    if (!_priceL) {
        
        _priceL = [[SLable alloc]initWithFrame:CGRectMake(GETSIZE(20), GETSIZE(10), GETSIZE(100), GETHEIGHT(40)) Text:@"¥99" Font:16 Color:Red textAligMent:NSTextAlignmentLeft];
        
    }
    return _priceL;
}

#pragma mark-折扣
-(SLable *)zheKouL{
    
    if (!_zheKouL) {
        
        _zheKouL = [[SLable alloc]initWithFrame:CGRectMake(GETSIZE(100), GETSIZE(20), GETSIZE(80), GETHEIGHT(25)) Text:@"1590(0.2折)" Font:16 Color:gray textAligMent:NSTextAlignmentLeft];
    }
    
    return _zheKouL;
}


//#pragma mark-领券按钮
//-(UIButton *)quanBtn{
//
//    if (!_quanBtn) {
//
//        _quanBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//        _quanBtn.frame = CGRectMake(self.width-GETSIZE(160), 0, self.height, self.height);
//        [_quanBtn setTitle:@"领券" forState:UIControlStateNormal];
//        _quanBtn.backgroundColor = Red;
//        [_quanBtn addTarget:self action:@selector(quanBtnShop:) forControlEvents:UIControlEventTouchUpInside];
//    }
//
//    return _quanBtn;
//}

#pragma mark --------------------
#pragma mark 领券事件处理
- (void)quanBtnShop:(UIButton *)quanBtn
{
    NSLog(@"领券");
}

#pragma mark-前往购买
-(UIButton *)buyBtn{
    
    if (!_buyBtn) {
        
        _buyBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _buyBtn.frame = CGRectMake(self.width-GETSIZE(100), 0, GETSIZE(100), self.height);
        [_buyBtn setTitle:@"前往购买" forState:UIControlStateNormal];
        _buyBtn.backgroundColor = orange;
        
        [_buyBtn addTarget:self action:@selector(buyBtnShop:) forControlEvents:UIControlEventTouchUpInside];
    }
    
    return _buyBtn;
}
#pragma mark --------------------
#pragma mark 前往购买事件处理
- (void)buyBtnShop:(UIButton *)buyBtn
{
    NSLog(@"前往购买");
}



- (void)configueDeatilWithModel:(FLMGoodsDetailListModel *)goodModels
{
    
    self.priceL.text = [NSString stringWithFormat:@"￥%@",goodModels.zk_final_price];
    
    self.zheKouL.text = @"(0.8折)";
}
@end
